<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); 
error_reporting(E_ALL);
/*function makeSpaces($number) {
	$number = (string)$number;
	$length = strlen($number);
	
	$count = (int)($length / 3);
	if ($count > 0) {
		$new_num = "";
		$i = 0;
		$str = strrev($number);
		while ($i < $count)
			$new_num .= substr($str,($i++)*3,3)." ";
		$new_num .= substr($str,$count*3,$length - $count*3);
		
		return strrev(trim($new_num));
	}
	return $number;
}*/

$db =& JFactory::getDBO();
$user =& JFactory::getUser();

$db->setQuery("select `date` from `wed_date` where `user_id` = '{$user->id}' limit 1");
$date = $db->loadResult();
?>
<link rel="stylesheet" href="<?php echo JRoute::_('/modules/mod_wed_date/style.css'); ?>" type="text/css" />
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/blitzer/jquery-ui.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JRoute::_('/modules/mod_wed_date/wed_date.js'); ?>"></script>
<label for="wed_date">Укажите дату свадьбы</label> <input type="text" id="wed_date" value="<?php echo $date; ?>" /> <input type="button" id="save_wed_date" value="Сохранить" /> <span id="save_result"></span>
<table id="wed_date_tbl" border="1">
	<tr>
		<td width='100px'>Со дня свадьбы в годах</td>
		<td>Название свадьбы</td>
		<td width='100px'>Число</td>
	</tr>
</table>